The File I/O API > The file I/O API > DWfile.read()

 

DWfile.read()

Availability

Dreamweaver 2.0

Description

Reads the contents of the specified file into a string.

Arguments

fileURL

The argument is the file you want to read, expressed as a file:// URL.

Returns

A string containing the contents of the file, or null if the read fails.

Example

The following code reads the file mydata.txt and, if successful, displays an alert box with the contents of the file.

var fileURL = "file:///c|/temp/mydata.txt";
var str = DWfile.read( fileURL);
if (str){
	alert( fileURL + " contains: " + str);
}